package com.kf.bigbluebook.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        // 网站标题
                        .title("大蓝书的Swagger文档")
                        // 描述 可以穿插md语法
                        .description("基于springboot的大学生交友平台")
                        // 版本
                        .version("1.0")
                        .build())
                .groupName("用户端接口")
                .select()
                // 要扫描的包
                .apis(RequestHandlerSelectors.basePackage("com.kf.bigbluebook.controller"))
                // 要扫描的url
                .paths(PathSelectors.any())
                .build();
    }
}
